﻿using System;

namespace Wisdom.Core.Repositories
{
    /// <summary>
    /// 仓库上下文.
    /// </summary>
    public interface IRepositoryContext : IUnitOfWork, IDisposable
    {
        /// <summary>
        /// 获得仓库上下文ID.
        /// </summary>
        Guid ID { get; }
        /// <summary>
        /// 注册一个新增聚合根到仓库上下文中.
        /// </summary>
        /// <typeparam name="TAggregateRoot">聚合根.</typeparam>
        /// <param name="obj">聚合根实例.</param>
        void RegisterNew<TAggregateRoot>(TAggregateRoot obj)
            where TAggregateRoot : class, IAggregateRoot;
        /// <summary>
        /// 注册一个修改聚合根到仓库上下文中.
        /// </summary>
        /// <typeparam name="TAggregateRoot">聚合根.</typeparam>
        /// <param name="obj">聚合根实例.</param>
        void RegisterModified<TAggregateRoot>(TAggregateRoot obj)
            where TAggregateRoot : class, IAggregateRoot;
        /// <summary>
        /// 注册一个删除聚合根到仓库上下文中.
        /// </summary>
        /// <typeparam name="TAggregateRoot">聚合根.</typeparam>
        /// <param name="obj">聚合根实例.</param>
        void RegisterDeleted<TAggregateRoot>(TAggregateRoot obj)
            where TAggregateRoot : class, IAggregateRoot;
    }
}
